package com.hsy.linemoney.apiservice;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 参数构造器
 * Created by MartinKent on 2016/9/8.
 */
public class ParamsMaker {
    private JSONObject object;

    private ParamsMaker() {
        object = new JSONObject();
    }

    public static ParamsMaker newInstance() {
        return new ParamsMaker();
    }

    public ParamsMaker add(String key, Object value) {
        try {
            object.put(key, value);
        } catch (JSONException e) {
            e.printStackTrace();
            object.remove(key);
        }
        return this;
    }

    public JSONObject get() {
        return object;
    }
}
